home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
007
/
qx16comm.aqm
/
qx16comm.asm
Wrap
Assembly Source File
|
1985-11-08
|
4KB
|
145 lines
page 60,132
title QX16 MS-DOS RECEIVE INTERUPT DRIVER
; Chuck Freeman - Technical Support Manager - Great Northern Epson
; (612) 559-0992 ext 42
;
; 30 Jul 85 Version 1.00 - Initial release
comment *
This routine will install a RS-232 receive interupt driver with a 32K buffer
for the Epson QX-16 operating under the MS-DOS 2.11 environment. This is just
a demonstration program and does not contain code for the following possible
error conditions:
1. Receive Buffer Overflow
2. Parity Error
3. Framming Error
4. Overrun Error
The Epson QX-16 utilizes a NEC 7201 Multi-Protocol Serial Controller chip
(register/command compatible with the INTEL 8274 and ZILOG SIO chips) for
the operation of the keyboard and RS-232 port. Port A of the 7201 is for
keyboard operation and Port B is for RS-232 operation.
*
;******************************************************************************
; The 8259 master and 8259 slave interupt controller vector table is located
; starting at address 0000:01C0 and ending at address 0000:01FF. The 7201
; serial device chip handles the keyboard and the rs232 port. When either
; device causes an interupt, an INT 70 (address 0000:01C0) is executed. The
; purpose of this routine is to determine which device (keyboard or rs232)
; caused the interupt, and branch to the proper routine to service the
; interupting device.
;
; INT 7E (address 0000:01F8) is a vector pointing to the keyboard decoded
; interupt routine.
;
; INT 7F (address 0000:01FC) is a vector pointing to the rs232 decoded
; interupt routine. In the current production release of the qx-16, if you
; trace this routine with DEBUG, the actual routine does a IRET. This section
; of code will change the INT 7F vector to point to our rs232 interupt handler
; and make resident within the ms-dos environment our interupt handler code.
; We will utilize standard ms-dos function requests to do this.
code_segment segment
assume cs:code_segment,ds:code_segment
start:
cli ;disable interupts
mov ax,code_segment ;get code segment
mov ds,ax ;and set data segment to same
mov ah,025h ;select vector function
mov al,07fh ;select rs232 decoded interupt vector
mov dx,offset decoded_rs232 ;point to our actual routine
int 021h ;set the new vector
mov al,001h
out 013h,al ;point to sio write register 1
mov al,010h
out 013h,al ;enable rs232 int on all rx char
sti ;enable interupts
mov ah,009h
mov dx,offset message
int 021h
mov ah,031h ;select terminate but stay resident
mov dx,interupt_length ;set our code length in paragraphs
int 021h ;do it and exit to ms-dos
message:
db 'RS-232 Interupt Driver Installed And Operational'
db 00dh,00ah,'$'
;****************************************************************************
interupt_begin equ $
decoded_rs232:
sti
mov ax,code_segment ;get code segment
mov ds,ax ;and set data segment to same
push bx
in al,011h ;get the received character
mov si,offset receive_buffer;get put buffer pointer
mov bx,[put_pointer] ;save received character
mov [bx+si-1],al
inc bx
mov [put_pointer],bx
pop bx
mov al,bl ;get bios saved rr0 status
test al,00000100b ;test transmbit buffer empty interupt
jnz continue ;false - so do not reset tbe interupt
mov al,028h
out 013h,al ;rest transmit buffer empty interupt
continue:
cli ;disable interupts
mov al,030h
out 013h,al ;reset sio errors
mov al,010h
out 013h,al ;reset external/status errors
mov al,038h
out 013h,al ;sio end of interupt
sti ;enable interupts
pop ax ;get ip off of stack from int 7f
pop bx ;get cs off of stack from int 7f
popf ;get flags off of stack from int 7f
stc ;set carry for bios routine
pushf ;save flags for iret from int 7f
push bx ;save cs for iret from iret 7f
push ax ;save ip for iret from iret 7f
iret ;all done
put_pointer label word
dw 00001h
receive_buffer label byte
db 08000h dup (?)
interupt_end equ $
interupt_length equ (((interupt_end-interupt_begin)/010h)+1)
;-----------------------------------------------------------------------------
code_segment ends
end start